<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css"></style>
</head>
<body>
    <h1>location</h1>
    <hr>

    <button onclick="location.reload()">刷新</button>

    <button onclick="location.assign('http://jd.com')">assgin</button>
    <button onclick="location.replace('http://sina.com')">replace</button>
    <button onclick="location.href='http://163.com'">href</button>

    

    <script>
        // console.log(location);
        console.log('URL:' + location.href);
        console.log('主机名和端口号:' + location.host);
        console.log('主机名:' + location.hostname);
        console.log('协议:' + location.protocol);
        console.log('pathname:' + location.pathname);
        console.log('search:' + location.search);
        console.log('hash:' + location.hash);

        // location.href = 'http://www.huaban.com';
        
        // location.search = '?name=laowang';
        // location.hash = '#4p';

    </script>
</body>
</html>